package net.wsfcp.android.http.mvp.presenter;

import net.wsfcp.android.base.BasePresenter;
import net.wsfcp.android.bean.requestbean.ReqUpdateUserBean;
import net.wsfcp.android.bean.resultbean.BillBean;
import net.wsfcp.android.bean.resultbean.QiniuUploadImageBean;
import net.wsfcp.android.bean.resultbean.UserAssetsBean;
import net.wsfcp.android.http.mvp.IModel;
import net.wsfcp.android.http.mvp.contract.BillContract;
import net.wsfcp.android.http.mvp.contract.InfoContract;
import net.wsfcp.android.http.mvp.model.BillModel;
import net.wsfcp.android.http.mvp.model.InfoModel;
import net.wsfcp.android.ui.view.my.activity.BillListActivity;
import net.wsfcp.android.ui.view.my.activity.InfoActivity;

import java.io.File;
import java.util.HashMap;

/**
 * Created by Shaoboyang on 2018/12/14.
 */
//我的账单
public class InfoPresenter extends BasePresenter<InfoActivity> implements
        InfoContract.InfoPresenter {


    @Override
    public void upLoadImg(File file, String fileName) {
        ((InfoModel) getiModelMap().get("upload_img")).uploadImg(file, fileName, new InfoModel
                .UploadImgInfoHint() {
            @Override
            public void uploadImgSuccessInfo(QiniuUploadImageBean bean) {
                getIView().upLoadImageSuccess(bean);
            }

            @Override
            public void uploadImgFailInfo(String str) {
                getIView().upLoadImageFail(str);
            }


        });
    }

    @Override
    public void updateUser(ReqUpdateUserBean bean) {
        ((InfoModel) getiModelMap().get("update_user")).updateUser(bean, new InfoModel
                .UpdateUserInfoHint() {
            @Override
            public void updateUserSuccessInfo() {
                getIView().upDateUserSuccess();
            }

            @Override
            public void updateUserFailInfo(String str) {
                getIView().upDateUserFail(str);
            }


        });
    }


    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new InfoModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {
        HashMap<String, IModel> map = new HashMap<>();
        map.put("upload_img", models[0]);
        map.put("update_user", models[0]);
        return map;
    }


}
